/**
 * <p>Title: Fault.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张小飞
 * @version 1.0
 * <pre>Histroy:
 *          2012-1-10 上午11:10:41  张小飞  Create
 *</pre>
 */
package com.baosight.sczx.common.zm.cInterface.ce;

import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;

/**
 * <p>Title: Fault.java</p>
 * <p>Description: 有关故障的接口方法</p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张小飞
 * @version 1.0
 * <pre>Histroy:
 *          2012-1-10 上午11:10:41  张小飞  Create
 *</pre>
 */
public class Fault {
	
	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	
	/**
	 * 
	 * <p>Function: getPhenomenonBlock</p>
	 * <p>Description: 获取故障现象的block</p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-1-10上午11:23:24 张小飞
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static EiBlock getPhenomenonBlock(String blockName, Map params){                                                              
		EiBlock block = new EiBlock(blockName);
		
		EiColumn eiColumn = new EiColumn("fdKeyId");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdCode");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		List<Map> list = dao.query("ZMCEFaultPhenomenon.queryInterface", params);
		block.setRows(list);
		return block;
	}
	
	/**
	 * 
	 * <p>Function: getReasonBlock</p>
	 * <p>Description: 获取故障原因的block</p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-1-10上午11:23:50 张小飞
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static EiBlock getReasonBlock(String blockName, Map params){                                                              
		EiBlock block = new EiBlock(blockName);
		
		EiColumn eiColumn = new EiColumn("fdKeyId");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdCode");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		List<Map> list = dao.query("ZMCEFaultReason.queryInterface", params);
		block.setRows(list);
		return block;
	}
}
